﻿using Microsoft.EntityFrameworkCore;
using ZH.GPT.Domains.User.Response;
using ZH.GPT.Infrastructures.Entities;
using ZH.GPT.Infrastructures.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ZH.GPT.Domains.ChatMessage.Request;
using ZH.GPT.Domains.ChatMessage.Response;

namespace ZH.GPT.Infrastructures.Repositories.Interface
{
    /// <summary>
    /// 消息接口
    /// </summary>
    public interface IChatRepository
    {
        /// <summary>
        /// 添加聊天
        /// </summary>
        /// <param name="chat"></param>
        /// <returns></returns>
        public Task<bool> AddChat(Chat chat);
        /// <summary>
        /// 添加聊天信息
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public Task<bool> AddChatMessage(ChatMessage msg);
        /// <summary>
        /// 添加多条聊天信息
        /// </summary>
        /// <param name="msgs"></param>
        /// <returns></returns>
        public Task<bool> AddChatMessages(List<ChatMessage> msgs);

        /// <summary>
        /// 获取消息
        /// </summary>
        /// <param name="chatMessage"></param>
        /// <returns></returns>
        Task<ChatMessagesPDTO> GetChatMessageAsync(ChatMessageQDTO chatMessage);
        /// <summary>
        /// 获取聊天信息条数
        /// </summary>
        /// <param name="chatId"></param>
        /// <returns></returns>
        Task<int> GetChatMessageCount(string chatId);

        /// <summary>
        /// 新增消息
        /// </summary>
        /// <param name="chatMessage"></param>
        /// <returns></returns>
        Task<(bool, string)> AddChatMessageAsync(ChatMessageDTO chatMessage);
        /// <summary>
        /// 列出用户所有聊天
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        Task<List<ChatPDTO>> GetChatsAsync(string userId);
        /// <summary>
        /// 查询用户
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        Task<User> GetUser(string userId);
        void UpdateUser(User user);
    }
}
